<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
//引用对应的命名空间
 use Gregwar\Captcha\CaptchaBuilder;
 use Session;
class CodeController extends Controller {

    public function captcha($temp) {
        $builder = new CaptchaBuilder();
        $builder->build(150, 32);
//           获取验证码内容
        $phrase = $builder->getPhrase(); 
        //把内容存入session         
        //Session::flash('milkcaptcha', $phrase); //存储验证码         
        //ob_clean(); //清除缓存
        return response($builder->output())->header('Content-type', 'image/jpeg'); //把验证码数据以jpeg图片的格式输出
    }

}
